<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>elFinder</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2" />
<script src="../jquery/jquery-1.8.3.min.js" type="text/javascript"></script>
<script src="../jquery-ui-1.11.4/jquery-ui.min.js"></script>
<link href="../jquery-ui-themes-1.11.4/themes/smoothness/jquery-ui.min.css" rel="stylesheet" />
<link href="css/theme.css" rel="stylesheet" />
<link href="css/elfinder.min.css" rel="stylesheet" />
<script src="js/elfinder.min.js"></script>
<script src="js/i18n/elfinder.zh_CN.js"></script>
<script type="text/javascript" charset="utf-8">
    function getUrlParam (paramName) {
	    var reParam = new RegExp ('(?:[\?&]|&amp;)' + paramName + '=([^&]+)', 'i');
	    var match = window.location.search.match (reParam);
	    
	    return (match && match.length > 1) ? match[1] : '';
    }

    $ ().ready (function () {
	    var funcNum = getUrlParam ('CKEditorFuncNum');
	    var fileServer = getUrlParam ('fileServer');
	    var userId = getUrlParam ('userId');
	    var mime = getUrlParam ('mime');
	    var myArray=new Array();
	    if(mime!='' && mime!=null && mime!=undefined){
	    	myArray[0] = mime;
	    }
	    var elf = $ ('#elfinder').elfinder ({
	        url : fileServer +'elfinder/connector',
	        lang : 'zh_CN',
	        customData : {"userId" : userId},
	        onlyMimes: myArray,
	        height : document.body.scrollHeight - 20,
	        uiOptions : {
	            toolbar : [
	                ['mkdir', 'upload'],
	                ['open', 'download','getfile'],
	                ['info'],
	                ['quicklook'],
	                ['copy','cut', 'paste'],
	                ['rm'],
	                ['rename', 'resize'],
	                ['search'],
	                ['view', 'sort']
	            ]
	        },
	        contextmenu : {
	    		// navbarfolder menu
	    		navbar : ['open', 'download', '|', 'upload', 'mkdir', '|', 'copy', 'cut', 'paste', 'duplicate', '|', 'rm', '|', 'rename', '|', 'archive', '|', 'places', 'info', 'chmod', 'netunmount'],
	    		// current directory menu
	    		cwd    : ['reload' , '|', 'upload', 'mkdir', 'paste', '|', 'view', 'sort', 'colwidth', '|', 'fullscreen'],
	    		// current directory file menu
	    		files  : ['getfile', '|' , 'download', 'opendir', 'quicklook',  '|', 'copy', 'cut', 'paste',  '|', 'rm', '|',  'rename', 'resize','info']
	    	},
	        getFileCallback : function (file) {
		        window.opener.CKEDITOR.tools.callFunction (funcNum, file.url);
		        elf.destroy ();
		        window.close ();
	        },
	        resizable : false
	    }).elfinder ('instance');
    });
</script>
</head>
<body>

	<!-- Element where elFinder will be created (REQUIRED) -->
	<div id="elfinder"></div>

</body>
</html>
